const express = require('express');
const router = express.Router();
const pool = require('../database/db');
const ThingController = require('../controller/ThingController');
// 引入验证中间件

// 初始化控制器
const thingController = new ThingController(pool);

// 获取当前用户的所有待办事项
router.get('/list', (req, res) => thingController.getThingsList(req, res));

// 添加待办事项
router.post('/add', (req, res) => thingController.addThing(req, res));

// 删除待办事项
router.delete('/delete/:id', (req, res) => thingController.deleteThing(req, res));

// 更新待办事项
router.put('/update/:id', (req, res) => thingController.updateThing(req, res));

// 完成待办事项
router.put('/toggle/:id', (req, res) => thingController.toggleThing(req, res));

module.exports = router;